Skip to content

[pull] master from DataDog:master#519

Merged
pull[bot] merged 4 commits into
ConnectionMaster:masterfrom
DataDog:master
May 5, 2026
Merged

[pull] master from DataDog:master#519
pull[bot] merged 4 commits into
ConnectionMaster:masterfrom
DataDog:master

Conversation

@pull

@pull pull Bot commented May 5, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

joelmarcotte and others added 4 commits May 5, 2026 14:28
* postgres: surface integration and DBM setup issues via `agent diagnose`

Add explicit pre-flight diagnostics for the Postgres integration so
`datadog-agent diagnose` flags missing prerequisites (connection, version,
pg_monitor, pg_stat_activity, SPL, pg_stat_statements, datadog schema,
USAGE grants, explain function) with actionable remediation text.

DBM probes are gated on the relevant subfeatures (query_metrics /
query_samples / query_activity), use cascade-skipping to avoid
nonsensical downstream FAILs, and -- when database_autodiscovery is
enabled -- run per-database for every step the docs require in each
monitored database. Config validation also surfaces here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix postgres diagnose runtime parity

* postgres: fix explain_function with trailing parens and add config_validation diagnostic metadata

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* postgres: probe connectivity to each autodiscovered database in agent diagnose

Per-database probing was gated behind dbm+query_samples, so CONNECT failures
on autodiscovered databases went unreported when DBM was disabled or when
only query_metrics/query_activity was enabled. Restructure _run so the
per-DB loop runs whenever autodiscovery is on, with DBM-specific schema and
explain-function probes layered inside.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* postgres: drop redundant 23433.fixed changelog

The 23433.added entry already broadly covers the diagnose feature in this PR;
the fixed entry was duplicative.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix Postgres diagnose query sample database probing

* postgres: tighten 23433.added changelog wording

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* postgres: dedupe and parametrize test_diagnose

Collapse redundant tests subsumed by cascade-skip cases, parametrize the
GUC warnings, subfeature gating, unqualified explain function, connection
failure, and autodiscovery connectivity tests, and add small helpers
(_run, _patch_per_db, _override, _dbm_check, _assert_all_succeed) to drop
~30 boilerplate blocks. 56 → 46 test functions, 1356 → 1141 lines, same
59-case run after parametrization.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* postgres: probe pg_monitor and SELECT on pg_stat_database in agent diagnose

Run the pg_monitor membership check unconditionally (it's the baseline grant
for relations, activity, and statements) and add a probe that runs the actual
SELECT on pg_stat_database, since deadlock/conflict/connection metrics depend
on it on every run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Address Postgres diagnose review feedback

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…patibility (#23593)

* Fix quotes in SQL query for TABLE_TYPE

Reference: #23590

Use single quotes

Description
The SQL_TABLES query in mysql/datadog_checks/mysql/queries.py uses double quotes for the string literal "BASE TABLE":

When sql_mode includes ANSI_QUOTES, MySQL interprets "BASE TABLE" as an identifier (column name) rather than a string literal, causing:

```
SQL_TABLES = """\
SELECT table_name as `name`,
       engine as `engine`,
       row_format as `row_format`,
       create_time as `create_time`
       FROM information_schema.TABLES
       WHERE TABLE_SCHEMA = %s AND TABLE_TYPE="BASE TABLE"
"""

```

When sql_mode includes ANSI_QUOTES, MySQL interprets "BASE TABLE" as an identifier (column name) rather than a string literal, causing:

> pymysql.err.OperationalError: (1054, "Unknown column 'BASE TABLE' in 'where clause'")

Fix
Replace double quotes with single quotes:
> WHERE TABLE_SCHEMA = %s AND TABLE_TYPE='BASE TABLE'

Environment
Agent version: 7.77.3
Aurora MySQL 8.0 with ANSI_QUOTES in sql_mode
Feature: collect_schemas: enabled: true

Stack trace
> mysql:ef67b735b4a65475 | (tracking.py:84) | operation _get_tables error
  File "databases_data.py", line 312, in _get_tables
    self._cursor_run(cursor, query=SQL_TABLES, params=db_name)
  File "databases_data.py", line 156, in _cursor_run
    cursor.execute(query, params)
pymysql.err.OperationalError: (1054, "Unknown column 'BASE TABLE' in 'where clause'")

* Fix SQL_TABLES query for ANSI_QUOTES compatibility - add changelog entry

* Update mysql/changelog.d/23593.fixed

Co-authored-by: Eric Weaver <eweaver755@gmail.com>

---------

Co-authored-by: Eric Weaver <eweaver755@gmail.com>
@pull pull Bot locked and limited conversation to collaborators May 5, 2026
@pull pull Bot added the ⤵️ pull label May 5, 2026
@pull pull Bot merged commit 891aa96 into ConnectionMaster:master May 5, 2026
1 check passed
@pull pull Bot had a problem deploying to typo-squatting-release May 6, 2026 06:05 Failure
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants